home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles Flirt Up Your Life! (German)
/
Singles Flirt Up Your Life.iso
/
data1.cab
/
Statemachine
/
characterChar.lua
< prev
next >
Wrap
Text File
|
2004-01-29
|
2KB
|
57 lines
-- character interaction state machine
beginStateMachine()
onEnter(function(msg)
local character = getStateObjectFromID(msg.sender);
storeStateObject("character", character);
if getParent().isOneActionPointLocked(chair) then
-- action point is locked
getParent().setEmoticon(EMOTICON_CANNOT, EMOTICON_DELAY);
sendMsg("emoThink", getParent().walkSO);
exitStateMachine();
else
getParent().lockActionPoints(character);
end
end )
onExit(function(msg)
local character = retrieveStateObject("character");
getParent().unlockActionPoints(character);
removeStateObject("character");
end )
-- wait for other character
state("wait")
onEnter(function(msg)
local character = retrieveStateObject("character");
-- periodically send a message to the other
-- character that this character is ready
sendDelayedMsgThis("ready", 1000);
-- or, ofter a longer period of waiting, stop waiting
sendDelayedMsgThis("stop", 10000);
end )
onMsg("end", function(msg)
actionComplete();
end )
onMsg("queue", function(msg)
exitStateMachine();
end )
onMsg("stop", function(msg)
exitStateMachine();
end )
onMsg("ready", function(msg)
-- send a message to the other character
local character = retrieveStateObject("character");
sendMsg("partnerReady", character);
end )
onMsg("partnerReady", function(msg)
wNotify("partner is ready");
end )
endStateMachine()